import { notification } from 'antd';
import { getUuid } from '@/system/utils/UuidUtils';

// 气泡提示框
export const notice = {
  open: (title: string, message: string, config: any) => {
    const key = getUuid();
    notification.info({
      message: title,
      description: message,
      key: key,
      ...config,
    });
    return key;
  },
  info: (title: string, message: string) => {
    const key = getUuid();
    notification.info({
      message: title,
      description: message,
      key: key
    });
    return key;
  },
  success: (title: string, message: string) => {
    const key = getUuid();
    notification.success({
      message: title,
      description: message,
      key: key
    });
    return key;
  },
  error: (title: string, message: string) => {
    const key = getUuid();
    notification.error({
      message: title,
      description: message,
      key: key
    });
    return key;
  },
  warning: (title: string, message: string) => {
    const key = getUuid();
    notification.warning({
      message: title,
      description: message,
      key: key
    });
    return key;
  },
  warn: (title: string, message: string) => {
    const key = getUuid();
    notification.warn({
      message: title,
      description: message,
      key: key
    });
    return key;
  },
  close: (key: string) => {
    notification.close(key);
  },
  destroy: () => {
    notification.destroy();
  },
};
